Skip to content

refactor(toolbar): split the toolbar into floating, extension and shared - #123778

Merged
trunk-io[bot] merged 5 commits into
masterfrom
rafa/toolbar-floating-extension-shared
Oct 28, 2026
Merged

trunk-io[bot] merged 5 commits into
masterfrom
rafa/toolbar-floating-extension-shared

Conversation

@rafaeelaudibert

Copy link
Copy Markdown
Member

Problem

  • The floating toolbar and the browser extension live in one flat tree. A reader can't tell which code both forms run and which belongs to one of them.
  • So a change meant for one form can break the other, and the forms drift: each tool has its own floating menu and extension menu that draw the same thing.
  • Requested while reviewing the extension stack. This PR sits on top of feat(toolbar): explain extension tools on hover and caption each tool #123749 without joining the stack.

Changes

Three folders. Each file moves by which entry points reach it. An import walk from the floating entries (index.tsx, loader.ts) and the extension entries (panel.tsx, content.tsx, background.ts, pageAgent.ts) sorted 203 files.

flowchart LR
    subgraph Before
        F1[floating entries] --> T[(toolbar/ flat tree)]
        E1[extension entries] --> T
    end
    classDef phYellow fill:#f9bd2b,stroke:#f9bd2b,color:#000;
    classDef phGray fill:#e5e7eb,stroke:#c7ccd1,color:#000;
    class F1,E1 phYellow;
    class T phGray;
Loading
flowchart LR
    subgraph After
        F2[floating/] --> S[(shared/)]
        E2[extension/] --> S
    end
    classDef phYellow fill:#f9bd2b,stroke:#f9bd2b,color:#000;
    classDef phBlue fill:#1d4aff,stroke:#1d4aff,color:#fff;
    class F2,E2 phYellow;
    class S phBlue;
Loading
Folder Holds
shared/ Every kea logic, the API and auth helpers, the shims, utils, and the components both forms render
floating/ The entry, loader and lifecycle controller at the top. components/<feature>/ for the bar and menus, logics/
extension/ The five entry files and the README at the top. components/<feature>/, logics/panel/ and logics/page/ by where they run, messaging/, browser/
  • Logic moves to shared/. A form folder configures shared code: it mounts logics, binds them to its UI, and renders shared components with its own data.
  • Feature flags use one shared row. shared/flags/FeatureFlagRow.tsx renders a flag from props, and shared/flags/flagInfo.ts maps a toolbar flag to the FlagInfo shape the extension already posts.
    • The floating row no longer prints "undefined%" for a variant without a rollout. It now shows the payload error under the editor.
    • The extension keeps its data-attr values.
  • The layout is enforced. toolbar/toolbarLayout.test.ts fails when shared/ imports a form, or when the two forms import each other. On its first run it caught one shared test that rendered through a floating binding. That test now lives with the binding.
  • Ownership: owners.yaml gives the whole toolbar to team-growth.
  • Mechanical: the build config, the graph guard and its baseline, vite.config.mts, a semgrep rule, Storybook timings, TELEMETRY.md, the product tours doc and the toolbar skill point at the new paths. Kea logic path([...]) values stay as they are, so no persisted state resets.
Floating flags, before Floating flags, after
before after

The extension's flags tool looks the same as before.

Note

More menus still draw the same UI in both forms. These are candidates for the same treatment as flags, largest first: heatmap (418 and 349 lines), events (217 and 167), the action editor (140 and 121), the experiment editor (129 and 134), and the inspected element (88 and 93).

How did you test this code?

  • pnpm typescript:check passes, and the toolbar and heatmap Jest suites pass.
  • pnpm build:toolbars builds both forms, and the extension output has the same files. check-toolbar-size, check-toolbar-graph and check-toolbar-csp-eval pass.
  • A static build of all 31 toolbar stories passes test-storybook.
  • The flag screenshots come from that build and from the same story on the base branch.
  • Not checked: the built extension in a real browser, and the floating toolbar on a live page.

Test rationale: toolbarLayout.test.ts catches a shared module that starts to import one form, which would couple the forms again. No other check covers that boundary. The moves need no new tests: the existing suites move with their subjects.

Release status

  • No feature flag controls this change

Docs update

The toolbar skill describes the layout, and TELEMETRY.md points every event at its new file.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Claude Opus 5.5 (claude-opus-5-5)

  • Base: the top layer of stack #123750, feat(toolbar): explain extension tools on hover and caption each tool #123749. The PR is not in the stack, which keeps the stack at five layers.
  • How the move ran: a script walked the import graph with the TypeScript resolver, moved files with git mv, and rewrote every specifier that pointed at a moved file. That covers relative paths, ~/toolbar/ aliases and jest.mock paths.
  • Commits: the split, the shared flag row, and the inner folders land as three separate commits.
  • Skills used: /building-the-toolbar, /writing-ui-components, /writing-tests, /writing-pr-descriptions.
  • Data: the screenshots show story fixtures only.

🤖 Generated with Claude Code

@rafaeelaudibert rafaeelaudibert self-assigned this Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 52 functions above the limit (max 46)

Cyclomatic complexity above the limit in changed typescript files (10 for production files, 15 for test files). Warn only: worth simplifying when you next touch these functions.

Function Location Complexity Limit
StepCard frontend/src/toolbar/floating/components/product-tours/StepCard.tsx:26 46 10
Toolbar frontend/src/toolbar/floating/components/bar/Toolbar.tsx:485 31 10
<anonymous> frontend/src/toolbar/shared/elements/HeatmapOverlayElements.tsx:45 29 10
HeatmapToolbarMenu frontend/src/toolbar/floating/components/stats/HeatmapToolbarMenu.tsx:82 27 10
ExtensionHeatmapMenu frontend/src/toolbar/extension/components/stats/ExtensionHeatmapMenu.tsx:80 26 10
ToolbarInfoMenu frontend/src/toolbar/floating/components/bar/Toolbar.tsx:376 24 10
processElements frontend/src/toolbar/shared/elements/heatmapToolbarMenuLogic.ts:1080 24 10
handleCommand frontend/src/toolbar/extension/logics/page/extensionPageHeatmapLogic.ts:427 21 10
ExtensionEventsMenu frontend/src/toolbar/extension/components/debug/ExtensionEventsMenu.tsx:31 19 10
ProductToursSidebar frontend/src/toolbar/floating/components/product-tours/ProductToursSidebar.tsx:23 19 10
restoreOAuthTokens frontend/src/toolbar/shared/toolbarConfigLogic.ts:630 19 10
getElementForStep frontend/src/toolbar/shared/utils.ts:489 18 10
actionStepToActionStepFormItem frontend/src/toolbar/shared/utils.ts:557 18 10
getExtensionPanelState frontend/src/toolbar/extension/logics/panel/extensionPanelState.ts:69 17 10
selectElement frontend/src/toolbar/shared/elements/elementsLogic.ts:732 17 10
EventDebugMenu frontend/src/toolbar/floating/components/debug/EventDebugMenu.tsx:45 16 10
ElementInfoWindow frontend/src/toolbar/floating/components/elements/ElementInfoWindow.tsx:8 16 10
iframeEventListener frontend/src/toolbar/shared/bar/toolbarLogic.ts:1010 16 10
getCandidatesFromIndex frontend/src/toolbar/shared/elements/domElementIndex.ts:182 16 10
matchEventToElementUsingSelectors frontend/src/toolbar/shared/elements/domElementIndex.ts:423 16 10
handleCommand frontend/src/toolbar/extension/logics/page/extensionPageExperimentsLogic.ts:284 15 10
ElementInfo frontend/src/toolbar/floating/components/elements/ElementInfo.tsx:16 15 10
stepAreaCandidate frontend/src/toolbar/shared/elements/heatmapToolbarMenuLogic.ts:139 15 10
ExtensionFlagsMenu frontend/src/toolbar/extension/components/flags/ExtensionFlagsMenu.tsx:17 14 10
run frontend/src/toolbar/extension/pageAgent.ts:156 14 10
getElementStats frontend/src/toolbar/shared/elements/heatmapToolbarMenuLogic.ts:909 14 10
elementIsVisible frontend/src/toolbar/shared/utils.ts:363 14 10
ExtensionScreenshotForEvent frontend/src/toolbar/extension/components/more/ExtensionScreenshotForEvent.tsx:13 13 10
ExtensionPanelSettings frontend/src/toolbar/extension/components/panel/ExtensionPanelSettings.tsx:19 13 10
setMode frontend/src/toolbar/extension/logics/page/extensionPageToolbarLogic.ts:224 13 10
mountToolbar frontend/src/toolbar/floating/index.tsx:140 13 10
fingerprintMatchesEventElement frontend/src/toolbar/shared/elements/domElementIndex.ts:226 13 10
inspectElementSelected frontend/src/toolbar/shared/experiments/experimentsTabLogic.tsx:522 13 10
inferSelector frontend/src/toolbar/shared/product-tours/elementInference.ts:202 13 10
extractErrorDetail frontend/src/toolbar/shared/toolbarApi.ts:94 13 10
ExtensionActionEditor frontend/src/toolbar/extension/components/actions/ExtensionActionEditor.tsx:20 12 10
getElementStatsSuccess frontend/src/toolbar/shared/elements/heatmapToolbarMenuLogic.ts:1428 12 10
previewTour frontend/src/toolbar/shared/product-tours/productToursLogic.ts:860 12 10
withTokenRefresh frontend/src/toolbar/shared/toolbarAuth.ts:81 12 10
trimElement frontend/src/toolbar/shared/utils.ts:302 12 10
submitFeedback frontend/src/layout/InternalFeedback/internalFeedbackLogic.ts:266 11 10
loadMoreAreaEvents frontend/src/lib/components/heatmaps/heatmapDataLogic.ts:819 11 10
ExtensionInspectedElement frontend/src/toolbar/extension/components/elements/ExtensionInspectedElement.tsx:16 11 10
ExtensionExperimentEditor frontend/src/toolbar/extension/components/experiments/ExtensionExperimentEditor.tsx:26 11 10
ToolBody frontend/src/toolbar/extension/components/panel/ExtensionPageToolbarTools.tsx:28 11 10
handleCommand frontend/src/toolbar/extension/logics/page/extensionPageEventsLogic.ts:237 11 10
FieldNotesOverlay frontend/src/toolbar/floating/components/field-notes/FieldNotesOverlay.tsx:16 11 10
StepField frontend/src/toolbar/shared/actions/StepField.tsx:41 11 10
setVisibleMenu frontend/src/toolbar/shared/bar/toolbarLogic.ts:765 11 10
FeatureFlagRow frontend/src/toolbar/shared/flags/FeatureFlagRow.tsx:31 11 10
toolbarFetch frontend/src/toolbar/shared/toolbarFetch.ts:25 11 10
finder frontend/src/toolbar/shared/vendor/finder/index.ts:122 11 10
✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Duplication (TypeScript) — 4 new duplicated blocks (worst 100 tokens)

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

First copy Second copy Lines Tokens
frontend/src/toolbar/shared/field-notes/fieldNotesLogic.ts:414 frontend/src/toolbar/shared/product-tours/productToursLogic.ts:1086 15 100
frontend/src/lib/components/heatmaps/ScrollDepthCanvas.tsx:153 frontend/src/toolbar/shared/elements/ScrollDepth.tsx:69 17 91
frontend/src/toolbar/shared/field-notes/fieldNotesLogic.ts:391 frontend/src/toolbar/shared/product-tours/productToursLogic.ts:1045 13 80
frontend/src/toolbar/shared/bar/toolbarLogic.ts:163 products/web_analytics/frontend/heatmaps/components/heatmapsBrowserLogic.ts:155 15 71
✅ Comment density — 1% of added code lines are comments (10 of 1136)

This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.

Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.

Files with the most added comment lines:

File Comment lines Added lines
frontend/src/toolbar/shared/flags/FeatureFlagRow.tsx 4 126
frontend/src/toolbar/floating/components/flags/FlagsToolbarMenu.tsx 2 183
frontend/src/toolbar/shared/flags/flagInfo.ts 2 34
frontend/toolbar-config.mjs 2 11

This check does not block merging. It updates on every push and clears when the share drops.

⚠️ Bundle size — 🔺 +954 B (+0.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 77.18 MiB · 🔺 +954 B (+0.0%)

File Size Δ vs base
toolbar/src/toolbar/floating/components/debug/chunk-EventDebugMenu.js 310.0 KiB 🔺 +310.0 KiB (new)
toolbar/src/toolbar/debug/chunk-EventDebugMenu.js removed 🟢 -310.0 KiB (-100.0%)
toolbar/src/toolbar/toolbar-app.js removed 🟢 -75.7 KiB (-100.0%)
toolbar/src/toolbar/floating/toolbar-app.js 75.7 KiB 🔺 +75.7 KiB (new)
toolbar/src/toolbar/floating/components/stats/chunk-HeatmapToolbarMenu.js 47.9 KiB 🔺 +47.9 KiB (new)
toolbar/src/toolbar/stats/chunk-HeatmapToolbarMenu.js removed 🟢 -47.9 KiB (-100.0%)
toolbar/src/toolbar/actions/chunk-ActionsToolbarMenu.js removed 🟢 -17.1 KiB (-100.0%)
toolbar/src/toolbar/floating/components/actions/chunk-ActionsToolbarMenu.js 17.1 KiB 🔺 +17.1 KiB (new)
toolbar/src/toolbar/floating/components/product-tours/chunk-ProductToursSidebar.js 14.1 KiB 🔺 +14.1 KiB (new)
toolbar/src/toolbar/product-tours/chunk-ProductToursSidebar.js removed 🟢 -14.1 KiB (-100.0%)
toolbar/src/toolbar/floating/components/experiments/chunk-ExperimentsToolbarMenu.js 11.9 KiB 🔺 +11.9 KiB (new)
toolbar/src/toolbar/experiments/chunk-ExperimentsToolbarMenu.js removed 🟢 -11.9 KiB (-100.0%)
toolbar/src/toolbar/floating/components/flags/chunk-FlagsToolbarMenu.js 7.5 KiB 🔺 +7.5 KiB (new)
toolbar/src/toolbar/flags/chunk-FlagsToolbarMenu.js removed 🟢 -6.5 KiB (-100.0%)
toolbar/src/toolbar/floating/components/web-vitals/chunk-WebVitalsToolbarMenu.js 4.6 KiB 🔺 +4.6 KiB (new)
toolbar/src/toolbar/web-vitals/chunk-WebVitalsToolbarMenu.js removed 🟢 -4.6 KiB (-100.0%)
toolbar/src/toolbar/floating/components/field-notes/chunk-FieldNotesOverlay.js 2.6 KiB 🔺 +2.6 KiB (new)
toolbar/src/toolbar/field-notes/chunk-FieldNotesOverlay.js removed 🟢 -2.6 KiB (-100.0%)
toolbar/src/toolbar/field-notes/chunk-FieldNotesToolbarMenu.js removed 🟢 -2.3 KiB (-100.0%)
toolbar/src/toolbar/floating/components/field-notes/chunk-FieldNotesToolbarMenu.js 2.3 KiB 🔺 +2.3 KiB (new)
toolbar/src/toolbar/floating/components/product-tours/chunk-ProductToursToolbarMenu.js 1.7 KiB 🔺 +1.7 KiB (new)
toolbar/src/toolbar/product-tours/chunk-ProductToursToolbarMenu.js removed 🟢 -1.7 KiB (-100.0%)

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

⚠️ Eager graph — 3 over budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.01 MiB · 25 files no change █████████░ 88.2% of 1.14 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
2.97 MiB · 621 files no change ██████████ 98.0% of 3.03 MiB
🟡 authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.59 MiB · 2,569 files no change ██████████ 101.2% of 7.50 MiB
dashboard scene
src/scenes/dashboard/Dashboard.tsx
9.96 MiB · 3,738 files no change ██████████ 99.5% of 10.01 MiB
🟡 today home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
7.77 MiB · 2,662 files no change ██████████ 100.4% of 7.74 MiB
🟡 AI-first home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
8.02 MiB · 2,655 files no change ██████████ 101.4% of 7.91 MiB
events scene
src/scenes/activity/explore/EventsScene.tsx
9.40 MiB · 3,516 files no change ██████████ 98.0% of 9.59 MiB
web analytics scene
src/scenes/web-analytics/WebAnalyticsScene.tsx
10.34 MiB · 3,766 files no change ██████████ 95.4% of 10.83 MiB
replay detail scene
src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
8.44 MiB · 3,110 files no change █████████░ 89.1% of 9.47 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/zod/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/billing/billingLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/ProductEmptyState/productSetupPreloadLogic.ts stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/dashboards/frontend/widgets/previews/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/wizard/frontend/runs/WizardRunDetailsDrawer.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayShell.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayContextPanelFloating.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodaySidePanel.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayTopBar.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/todayRailItems.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 zod/v4/locales/de.js stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/queries/validators.js stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/project-homepage/today/TodayReportPage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 packages/quill/packages/charts/ stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 products/posthog_ai/frontend/components/tool/widgets/VisualizationWidget.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 products/posthog_ai/frontend/components/tool/widgets/RecordingsWidget.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 products/posthog_ai/frontend/api/primitives.ts stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 src/scenes/notebooks/Notebook/notebookLogic.ts stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/validators.js stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 products/product_analytics/frontend/insights/trends/WorldMap/countryVectors.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 src/scenes/settings/SettingsMap.tsx stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 @jspm/core/nodelibs/browser/fs stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.7 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
4.0 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.7 KiB src/index.tsx
1.7 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.7 KiB src/lib/utils/bootTiming.ts
1.2 KiB src/RootErrorBoundary.tsx
949 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
86.2 KiB src/lib/api.ts
68.3 KiB src/lib/lemon-ui/icons/icons.tsx
41.9 KiB ../node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
36.4 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
27.0 KiB ../node_modules/.pnpm/tailwind-merge@2.2.2/node_modules/tailwind-merge/dist/bundle-mjs.mjs
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
86.2 KiB src/lib/api.ts
Largest files eagerly shipped from src/scenes/dashboard/Dashboard.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
86.2 KiB src/lib/api.ts
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/activity/explore/EventsScene.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/web-analytics/WebAnalyticsScene.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
187.9 KiB src/queries/validators.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
Largest files eagerly shipped from src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
Size File
323.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
316.1 KiB ../node_modules/.pnpm/posthog-js@1.439.0_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.5 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

✅ Toolbar bundle — eager 2.31 MiB within budget

What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.

Metric Size Δ vs base Budget
Eager (shipped)
entry + static imports
2.31 MiB · 18 files 🟢 -3 B (-0.0%) ████░░░░░░ 40.3% of 5.72 MiB
Deferred (lazy) 2.11 MiB · 40 files 🔺 +956 B (+0.0%) n/a — loads on demand
Loader dist/toolbar.js 1.2 KiB no change █░░░░░░░░░ 6.0% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
915.2 KiB dist/toolbar/toolbar-app-DNCFYC5P.css
695.9 KiB dist/toolbar/chunk-chunk-FXE3TTXD.js
260.0 KiB dist/toolbar/chunk-chunk-TAKCWRUF.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
130.4 KiB dist/toolbar/chunk-chunk-JIZACMSE.js
75.7 KiB dist/toolbar/toolbar-app-NNGD3MFC.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-DLT2OPNX.js
21.7 KiB dist/toolbar/chunk-chunk-N2Y5W2UB.js
6.8 KiB dist/toolbar/chunk-chunk-DV7IWQNF.js

Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile

✅ Dist folder size — 🔺 +7.6 KiB (+0.0%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 972.77 MiB · 🔺 +7.6 KiB (+0.0%)

✅ Playwright — all passed

All tests passed.

View test results →

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 9dd1b9b: no findings. This pull request is large, so the review ran in 4 parts with less depth than usual.

@trunk-io

trunk-io Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@rafaeelaudibert
rafaeelaudibert requested review from a team, MattBro and fercgomes and removed request for a team October 27, 2026 03:40
@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-extension-panel-layout branch 2 times, most recently from 8f91c00 to 31b4635 Compare October 28, 2026 04:07
@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-floating-extension-shared branch from 9dd1b9b to f909f08 Compare October 28, 2026 04:09
@posthog

posthog Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Base automatically changed from rafa/toolbar-extension-panel-layout to master October 28, 2026 11:59
@trunk-io

trunk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

rafaeelaudibert and others added 5 commits October 28, 2026 10:50
The floating toolbar and the extension shared one flat tree, so nothing
showed which code both forms run and which belongs to one of them.

- shared/ holds what both forms use: the kea logics, the API and auth
  helpers, the shims, utils, and the components both render.
- floating/ holds the floating toolbar's entry, loader, bar and menus.
- extension/ stays where it was.

Files move by which entry points reach them, and tests, stories and
mocks follow their subject. Kea logic paths keep their values. The build
config, the graph guard and its baseline, and the docs point at the new
paths. toolbarLayout.test.ts fails when shared imports a form, or when
the forms import each other. owners.yaml gives the whole toolbar to
team-growth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orms

The floating toolbar and the extension each drew their own flag row. The
floating one printed "undefined%" for a variant with no rollout and never
showed a payload error.

shared/flags/FeatureFlagRow.tsx renders a flag from props, and
shared/flags/flagInfo.ts maps a toolbar flag to the FlagInfo shape the
extension already posts. Each form only binds the row to its own state,
and the extension keeps its data-attr values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… support folders

Both form folders still held most files at their top level, so the
entry points were hard to tell from everything else.

- floating/ and extension/ keep only the entry points the build names at
  the top.
- components/<feature>/ holds React components, stories and tests, with
  the feature names shared/ uses.
- logics/ holds each form's kea logics. The extension splits them into
  panel/ and page/ by where they run.
- extension/messaging/ holds the panel, content script and page agent
  protocol, and extension/browser/ the extension API wrappers.

The toolbar skill describes the layout. TELEMETRY.md points every event
at its new file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`toolbar`, `toolbar-extension` and `toolbars` did not say which form each
script builds. The scripts now use the floating and extension names from
the folder split, and `-all` for both forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 updated
Run: b04e0854-db7f-4554-bf16-de57f674a217
@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-floating-extension-shared branch from 5a1d668 to cd0f488 Compare October 28, 2026 13:52
@rafaeelaudibert
rafaeelaudibert marked this pull request as ready for review October 28, 2026 13:52
@rafaeelaudibert rafaeelaudibert added the stamphog Request AI approval (no full review) label Oct 28, 2026
@rafaeelaudibert
rafaeelaudibert requested review from a team October 28, 2026 13:52
@parameterai

parameterai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Risk: No findings

A mechanical refactor that splits the flat toolbar tree into floating/, extension/ and shared/, keeping every security-relevant module (OAuth refresh, toolbarFetch/toolbarApi transport, page-agent message protocol, page-toolbar bridge) byte-identical except for import-path rewrites. The only substantive new code is a shared FeatureFlagRow/flagInfo pair that both forms render, which I verified is behavior-equivalent to the two flag rows it replaces: overrides stay local to the browser, set/remove-on-rechoose semantics are preserved, and the extension keeps its per-form gating. I found no security vulnerability introduced by this change.

Sentinel reviewed cd0f488 · Review settings

@rafaeelaudibert

Copy link
Copy Markdown
Member Author

/trunk merge

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 28, 2026 13:53
@pr-assigner-resolver-posthog

Copy link
Copy Markdown

👀 Auto-assigned reviewers

These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:

  • @adboio (products/product_tours/product.yaml)

Soft owners come from each directory's owners.yaml and each product's product.yaml (resolved nearest-file-wins). For a skipped owner, the locator is the file that decided it. Generated files and lockfiles are ignored when deciding ownership.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved yet — waiting on the conditions below.

Re-add the stamphog label to request another review once you have addressed this.

Gates denied this PR because it changes protected build/tooling surfaces and exceeds the automated review size limit; executable manifest changes also independently require human review. Request review from @PostHog/team-devex and @PostHog/team-growth; the partial current-head automated review does not count as assurance.

  • PostHog Review (Standard) reviewed the current head (no findings) but skipped 1 changed file, so it does not count as assurance.
  • Dependency-manifest rule: frontend/package.json adds and renames executable toolbar build/watch scripts and changes the development startup command. Route these changes to @PostHog/team-devex for human review.
  • Trusted gate denial: protected toolchain, development guardrail and approval-policy surfaces were matched, and this cross-cutting refactor exceeds the automated review size ceiling. Request human review from @PostHog/team-growth and @PostHog/team-devex rather than re-requesting automated approval unchanged.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✗ matches: deps_toolchain, devex_guardrails, stamphog_policy (scripts/hooks changed in package.json)
size ✗ too large for auto-review (8977L substantive in global — ceiling is 800L; 8977L, 195F total, 9310L/230F incl. docs/generated/snapshots)
tier ✗ classified as T2-never: T2-never (9310L, 230F, cross-cutting, refactor)
stamphog 2.6.1 .stamphog/policy.yml @ cd0f488 · reviewed head cd0f488

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Oct 28, 2026

@fercgomes fercgomes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👨‍🦯👨‍🦯👨‍🦯👨‍🦯👨‍🦯👨‍🦯👨‍🦯

@trunk-io
trunk-io Bot merged commit 3a4ae82 into master Oct 28, 2026
315 of 367 checks passed
@trunk-io
trunk-io Bot deleted the rafa/toolbar-floating-extension-shared branch October 28, 2026 19:46
@deployment-status-posthog

deployment-status-posthog Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-28 20:06 UTC Run
prod-us ✅ Deployed 2026-10-28 20:35 UTC Run
prod-eu ✅ Deployed 2026-10-28 20:41 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants